.saasaparilla
	%h1 Subscription


	- if @subscription.status == "canceled"
		.info
			%p
				You do not have an active paid subscription. 
				= link_to "Reactivate your previous plan", reactivate_subscription_path, :confirm => "Are you sure you want to reactive your previous plan? Your credit card will be billed immediately."

	- else
		.info
			%h2 Plan

			%p 
				= "You are currently subscribed to the #{@subscription.plan.name} plan."
			%p
				= link_to "Change plan", edit_subscription_plan_path

		.info
			%h2 Billing Contact Info

			%p
				= "#{@subscription.contact_info.first_name} #{@subscription.contact_info.last_name}"
				%br
				= @subscription.contact_info.email
				%br
				- if @subscription.contact_info.require_billing_address?
					= @subscription.contact_info.address
					%br
					= "#{@subscription.contact_info.city}, #{@subscription.contact_info.state} #{@subscription.contact_info.zip}"
					%br
					= @subscription.contact_info.country
					%br
				- if @subscription.contact_info.require_phone_number?
					= "#{@subscription.contact_info.phone_number}"
			%p
				= link_to "Update", edit_subscription_contact_info_path(@subscription.contact_info)
	
		.info
			%h2 Billing Payment Info


			%p
				Card Number
				%br
				= @subscription.credit_card.card_number
			%p
				Expiration
				%br
				=@subscription.credit_card.expiration_date
			%p
				= link_to "Update", edit_subscription_credit_card_path(@subscription.credit_card)
	
		.info
			%h2 Billing History
			%p
				= "Balance: #{number_to_currency(@subscription.balance)}" 
				= link_to "Make a payment", new_subscription_payment_path if @subscription.balance > 0
				%br
				= "Your next billing date is #{@subscription.billing_date.to_s(:month_day_year)}"
				%br
				Your subscription was created on
				= @subscription.created_at.to_s(:month_day_year)
					
			%table.history-table
				= render :partial => 'saasaparilla/billing_history/billing_activity', :collection => @subscription.billing_activities.recent.limit(5)


		.info
			%h2 Actions
			%p
				= link_to "Cancel Subscription", @subscription, :method => "delete", :confirm => "Are you sure you want to cancel your subscription?"
